package communication.common.business.base;

import lombok.Getter;

import java.io.Serializable;

/**
 * @author mac
 */
@Getter
public enum WorkModeEnum implements Serializable {

    /**
     * server端
     */
    SERVER(0),

    /**
     * client端
     */
    CLIENT(1);


    private int mode;

    private WorkModeEnum(int mode) {
        this.mode = mode;
    }


    /**
     * 工作模式反转，client -> server ,server -> client
     * @return
     * @param mode
     */
    public static WorkModeEnum revertMode(WorkModeEnum mode){

        if(mode.equals(SERVER)){
            return CLIENT;
        }else {
            return SERVER;
        }
    }
}
